#tag Window
Begin Window Window1
   BackColor       =   16777215
   Backdrop        =   ""
   CloseButton     =   True
   Composite       =   False
   Frame           =   0
   FullScreen      =   False
   HasBackColor    =   False
   Height          =   64
   ImplicitInstance=   True
   LiveResize      =   True
   MacProcID       =   0
   MaxHeight       =   32000
   MaximizeButton  =   False
   MaxWidth        =   32000
   MenuBar         =   1934436351
   MenuBarVisible  =   True
   MinHeight       =   64
   MinimizeButton  =   True
   MinWidth        =   64
   Placement       =   0
   Resizeable      =   False
   Title           =   "Untitled"
   Visible         =   True
   Width           =   340
   Begin EditField EditField1
      AcceptTabs      =   ""
      Alignment       =   0
      AutoDeactivate  =   True
      BackColor       =   16777215
      Bold            =   ""
      Border          =   True
      DataField       =   ""
      DataSource      =   ""
      Enabled         =   True
      Format          =   ""
      Height          =   22
      HelpTag         =   ""
      Index           =   2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   20
      LimitText       =   0
      LockBottom      =   ""
      LockedInPosition=   False
      LockLeft        =   ""
      LockRight       =   ""
      LockTop         =   ""
      Mask            =   ""
      Multiline       =   ""
      Password        =   ""
      ReadOnly        =   ""
      Scope           =   0
      ScrollbarHorizontal=   ""
      ScrollbarVertical=   True
      Styled          =   ""
      TabIndex        =   0
      TabPanelIndex   =   0
      TabStop         =   True
      Text            =   10
      TextColor       =   0
      TextFont        =   "System"
      TextSize        =   0
      Top             =   19
      Underline       =   ""
      UseFocusRing    =   True
      Visible         =   True
      Width           =   48
      BehaviorIndex   =   0
   End
   Begin CheckBox CheckBox1
      AutoDeactivate  =   True
      Bold            =   ""
      Caption         =   "Enabled"
      DataField       =   ""
      DataSource      =   ""
      Enabled         =   True
      Height          =   20
      HelpTag         =   ""
      Index           =   2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   144
      LockBottom      =   ""
      LockedInPosition=   False
      LockLeft        =   ""
      LockRight       =   ""
      LockTop         =   ""
      Scope           =   0
      State           =   0
      TabIndex        =   1
      TabPanelIndex   =   0
      TabStop         =   True
      TextFont        =   "System"
      TextSize        =   0
      Top             =   20
      Underline       =   ""
      Visible         =   True
      Width           =   76
      BehaviorIndex   =   1
   End
   Begin myTimer Timer1
      FinishTime      =   0
      Height          =   32
      Index           =   2147483648
      Left            =   47
      LockedInPosition=   False
      Mode            =   2
      Period          =   300
      Scope           =   0
      TabPanelIndex   =   0
      Top             =   112
      Width           =   32
      BehaviorIndex   =   2
   End
   Begin StaticText StaticText1
      AutoDeactivate  =   True
      Bold            =   ""
      DataField       =   ""
      DataSource      =   ""
      Enabled         =   True
      Height          =   20
      HelpTag         =   ""
      Index           =   2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   80
      LockBottom      =   ""
      LockedInPosition=   False
      LockLeft        =   ""
      LockRight       =   ""
      LockTop         =   ""
      Multiline       =   ""
      Scope           =   0
      TabIndex        =   3
      TabPanelIndex   =   0
      Text            =   "Minutes"
      TextAlign       =   0
      TextColor       =   0
      TextFont        =   "System"
      TextSize        =   0
      Top             =   21
      Underline       =   ""
      Visible         =   True
      Width           =   43
      BehaviorIndex   =   3
   End
   Begin StaticText StaticText2
      AutoDeactivate  =   True
      Bold            =   ""
      DataField       =   ""
      DataSource      =   ""
      Enabled         =   True
      Height          =   20
      HelpTag         =   ""
      Index           =   2147483648
      InitialParent   =   ""
      Italic          =   ""
      Left            =   232
      LockBottom      =   ""
      LockedInPosition=   False
      LockLeft        =   ""
      LockRight       =   ""
      LockTop         =   ""
      Multiline       =   ""
      Scope           =   0
      TabIndex        =   4
      TabPanelIndex   =   0
      Text            =   ""
      TextAlign       =   0
      TextColor       =   &h000000
      TextFont        =   "System"
      TextSize        =   0
      Top             =   20
      Underline       =   ""
      Visible         =   True
      Width           =   88
      BehaviorIndex   =   4
   End
End
#tag EndWindow

#tag WindowCode
	#tag Event
		Sub Open()
		  Timer1.Enabled = False
		End Sub
	#tag EndEvent


#tag EndWindowCode

#tag Events EditField1
	#tag Event
		Sub GotFocus()
		  me.SelStart = 0
		  me.SelLength = len( me.text )
		End Sub
	#tag EndEvent
#tag EndEvents
#tag Events CheckBox1
	#tag Event
		Sub Action()
		  if me.Value then
		    if IsNumeric( EditField1.Text ) then
		      dim secs As Double = val( EditField1.Text ) * 60
		      dim d as new Date
		      d.TotalSeconds = d.TotalSeconds + secs
		      Timer1.reset d
		    else
		      EditField1.SetFocus
		      EditField1.SelStart = 0
		      EditField1.SelLength = len(EditField1.Text )
		      me.Value = False
		    end if
		  else
		    Timer1.Enabled = false
		  end if
		End Sub
	#tag EndEvent
#tag EndEvents
#tag Events Timer1
	#tag Event
		Sub secsLeft(secs As Integer)
		  dim mins as String = format( secs / 60 ,"0.00" )
		  if mins <> EditField1.Text then
		    EditField1.Text = mins
		  end if
		  dim d as new date
		  self.Title = d.longtime
		  
		End Sub
	#tag EndEvent
	#tag Event
		Sub Alarm()
		  speak "Your time has expired"
		End Sub
	#tag EndEvent
	#tag Event
		Sub secsElapsed(secs As Integer)
		  StaticText2.Text = format( secs, "0" ) + " secs elapsed"
		End Sub
	#tag EndEvent
#tag EndEvents
